﻿Imports Cls_Common
Imports VSModel
Partial Class FrontEnd_Control_QuangCao_Left
    Inherits System.Web.UI.UserControl
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Bind2Repeater()
        End If
    End Sub
    Protected Sub Bind2Repeater()
        Using _data As New VSEntities
            'Add DomainName DUC 09-09-2014
            Dim p = (From q In _data.ImagesAdvers Where q.Domain = DomainName And q.StatusID = 3 And q.Subject = ImageAdverType.Left Select q Order By q.Sort).ToList
            With rptImage
                .DataSource = p
                .DataBind()
            End With
        End Using
    End Sub
    Protected Sub rptImage_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptImage.ItemDataBound
        Dim row As VSModel.ImagesAdver = CType(e.Item.DataItem, VSModel.ImagesAdver)
        Dim hplTitle As HyperLink = CType(e.Item.FindControl("hplTitle"), HyperLink)
        hplTitle.NavigateUrl = row.URL
        Dim imgBig As Image = CType(e.Item.FindControl("imgBig"), Image)
        imgBig.ToolTip = row.Title
        imgBig.ImageUrl = row.SRC
    End Sub
End Class
